//
//  MessageAuthCodeViewController.m
//  UILbrary
//
//  Created by mac on 16/12/5.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "MessageAuthCodeViewController.h"
#import "GetMessageAuthCodeLabel.h"
@interface MessageAuthCodeViewController ()<getGetMessageAuthCodeLabelDelegate>

/**
 二维码label
 */
@property (nonatomic, strong) GetMessageAuthCodeLabel *messageLabel;
@end

@implementation MessageAuthCodeViewController

#pragma mark - life cycle methods
- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.messageLabel.frame = CGRectMake(100, 200, 200, 40);
    [self.view addSubview:self.messageLabel];
    
}

- (void)viewDidLayoutSubviews{
    [super viewDidLayoutSubviews];
    //使用VFL 语句来调整控件位置
    //属性控件，用下划线的格式 如：_messageLabel
//    NSDictionary *messageLabelDic = NSDictionaryOfVariableBindings(_messageLabel);
//    NSString *VFL1 = [NSString stringWithFormat:@"H:|-[_messageLabel]-|"];
//    
//    NSArray *contraint1 = [NSLayoutConstraint constraintsWithVisualFormat:VFL1 options:0 metrics:nil views:messageLabelDic];
//    
//    NSArray *contraint2 = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-100-[_messageLabel(==40)]" options:0 metrics:nil views:messageLabelDic];
//    [self.view addConstraints:contraint1];
//    [self.view addConstraints:contraint2];
    
    
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];

}


#pragma mark - getGetMessageAuthCodeLabelDelegate
//倒计时 按钮点击事件

- (void)clickEventIsStartContDown:(startCoutDown)countDown{
    countDown(YES);
}


#pragma mark - setter getter
- (GetMessageAuthCodeLabel *)messageLabel{
    
    if (!_messageLabel) {
        _messageLabel = [GetMessageAuthCodeLabel new];
        //new 会调用alloc initWtithFrame 方法
        //记得，要把translatesAutoresizingMaskIntoConstraints 属性设置为NO
        _messageLabel.userInteractionEnabled = YES;
        _messageLabel.translatesAutoresizingMaskIntoConstraints = NO;

        _messageLabel.seconds = 10;
        _messageLabel.normalColor = [UIColor orangeColor];
        _messageLabel.selectColor = [UIColor grayColor];
        _messageLabel.normalTitle = @"获取验证码";
        _messageLabel.selectTitle = @"请稍后";
        _messageLabel.delegate = self;
        
        _messageLabel.textColor = [UIColor whiteColor];
        _messageLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _messageLabel;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
